﻿<%@ Page Title="" Language="C#" MasterPageFile="~/TsSite.Master" AutoEventWireup="true" CodeBehind="ServiceCarList.aspx.cs" Inherits="TireService.Web.View.ResourceView.ServiceCarList" %>

<%@ Register assembly="DevExpress.Web.v11.1, Version=11.1.12.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxPanel" tagprefix="dx" %>
<%@ Register Assembly="DevExpress.Web.v11.1, Version=11.1.12.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web.ASPxRoundPanel" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.ASPxGridView.v11.1.Export, Version=11.1.12.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web.ASPxGridView.Export" TagPrefix="dxwgv" %>
<%@ Register assembly="DevExpress.Web.ASPxGridView.v11.1, Version=11.1.12.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxGridView" tagprefix="dxwgv" %>
<%@ Register assembly="DevExpress.Web.ASPxEditors.v11.1, Version=11.1.12.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxEditors" tagprefix="dxe" %>


<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    
    <table cellpadding="0" cellspacing="2" border="0">
        <tr>
            <td>
                <img id="imgServiceCar" alt="" src="~/Images/Medium/minibus_blue.png" runat="server" style="width: 32px; height: 32px" />
            </td>
            <td valign="middle">
                <h3><asp:Label ID="lblServiceCarHeader" runat="server" Text="Service biler"></asp:Label></h3>
            </td>
        </tr>
    </table>
    <hr />
                
    <!-- Javascript of action dropdown list -->
    <script language="javascript" type="text/javascript">

        // Function that handles actions selected in dropdown list
        function ActionClicked() {

            // Get selected action from dropdownlist
            var id = ddlAction.GetValue();

            if (id != null && id != 0) {
         

            }
            else {
                alert('Ingen handling valgt');
            }
        }

    </script>

    <table border="0" cellspacing="0" cellpadding="5" width="100%">
        <tr>
            <td style="width:150px">
                <dxe:ASPxComboBox ID="ddlAction" ClientInstanceName="ddlAction" runat="server" Width="150px">
                    <Items>
                        <dxe:ListEditItem Selected="true" Value="0" Text="-- Handling --" />
                    </Items>
                </dxe:ASPxComboBox>
            </td>
            <td style="width:75px">
                <dxe:ASPxButton ID="btnSubmitAction" runat="server" Text="Udfør" AutoPostBack="False" UseSubmitBehavior="False" Width="75px">
                    <ClientSideEvents Click="function(s, e) { ActionClicked(); }" />
                </dxe:ASPxButton>
            </td>
            <td style="width:150px">
                <dxe:ASPxComboBox ID="ddlExport" ClientInstanceName="ddlExport" runat="server" Width="150px">
                    <Items>
                        <dxe:ListEditItem Selected="True" Value="0" Text="Export pdf" />
                        <dxe:ListEditItem Value="1" Text="Export xls" />
                        <dxe:ListEditItem Value="2" Text="Export csv" />
                        <dxe:ListEditItem Value="3" Text="Export rtf" />
                    </Items>
                </dxe:ASPxComboBox>
            </td>
            <td style="width:75px">
                <dxe:ASPxButton ID="btnExport" runat="server" Text="Exporter" OnClick="btnExport_Click" Width="75px" >
                </dxe:ASPxButton>
            </td>
            <td align="right">
                <asp:Label ID="lblView" runat="server" Text="Visning"></asp:Label>
                <asp:DropDownList ID="ddlView" runat="server" AutoPostBack="True" 
                    onselectedindexchanged="ddlView_SelectedIndexChanged">
                    <asp:ListItem Value="0">Ingen gruppering</asp:ListItem>
                    <asp:ListItem Value="1">Grupper efter By</asp:ListItem>
                </asp:DropDownList>
                &nbsp;
                <asp:Label ID="lblPageSize" runat="server" Text="Antal linjer pr side"></asp:Label>
                <asp:DropDownList ID="ddlPageSize" runat="server" AutoPostBack="true">
                    <asp:ListItem Value="10">10</asp:ListItem>
                    <asp:ListItem Value="25">25</asp:ListItem>
                    <asp:ListItem Value="50">50</asp:ListItem>
                    <asp:ListItem Value="100">100</asp:ListItem>
                </asp:DropDownList>
            </td>
        </tr>
    </table>          
    <hr />
                
    <dxwgv:ASPxGridView ID="gvServiceCar" runat="server" ClientInstanceName="gvServiceCar" 
        KeyFieldName="ServiceCarId" Width="100%" AutoGenerateColumns="False" EnableCallBacks="True" 
        OnRowInserting="gvServiceCar_RowInserting"
        OnRowUpdating="gvServiceCar_RowUpdating">
        <SettingsLoadingPanel Text="Henter&amp;hellip;" />
        <Settings ShowHeaderFilterButton="true" ShowGroupPanel="true" ShowFilterRow="True" />
        <SettingsPager AlwaysShowPager="True" PageSize="20" Position="TopAndBottom">
            <Summary 
                AllPagesText="Sider: {0} - {1} ({2} servicebiler)" 
                Text="Side {0} af {1} ({2} servicebiler)" />
        </SettingsPager>
        <SettingsText ConfirmDelete="Vil du slette servicebil?" GroupPanel="Træk kolonne hertil for at gruppere efter den" HeaderFilterShowAll="Vis alle" />
        <SettingsBehavior ConfirmDelete="True" AllowGroup="true" AllowDragDrop="true" AllowFocusedRow="true" />
        <ClientSideEvents FocusedRowChanged="function(s, e) {
            if (typeof(gvContainerServiceCarCoverage) != 'undefined')
                gvContainerServiceCarCoverage.PerformCallback(s.GetFocusedRowIndex());
        }" 
        />
        <Columns>
            <dxwgv:GridViewCommandColumn VisibleIndex="0">
                <EditButton Visible="True" Text="Rediger" />
                <NewButton Visible="True" Text="Opret" />
            </dxwgv:GridViewCommandColumn>
            <dxwgv:GridViewCommandColumn ShowSelectCheckbox="True" VisibleIndex="1">
                    <HeaderTemplate>
                        <input type="checkbox" onclick="gvServiceCar.SelectAllRowsOnPage(this.checked);" style="vertical-align:middle;" title="Vælg/Fravælg alle linjer på siden"></input>
                    </HeaderTemplate>
                    <HeaderStyle Paddings-PaddingTop="1" Paddings-PaddingBottom="1" 
                        HorizontalAlign="Center">
                    <Paddings PaddingTop="1px" PaddingBottom="1px"></Paddings>
                    </HeaderStyle>
            </dxwgv:GridViewCommandColumn>
            <dxwgv:GridViewDataColumn FieldName="ServiceCarId" VisibleIndex="2" Caption="ServiceCar Id">
                <EditFormSettings Visible="False" />
            </dxwgv:GridViewDataColumn>
            <dxwgv:GridViewDataColumn FieldName="Description" VisibleIndex="3" Caption="Beskrivelse">
                <EditFormSettings VisibleIndex="0" />
            </dxwgv:GridViewDataColumn>
            <dxwgv:GridViewDataColumn FieldName="Address" VisibleIndex="4" Caption="Adresse">
                <EditFormSettings VisibleIndex="1" />
            </dxwgv:GridViewDataColumn>
            <dxwgv:GridViewDataColumn FieldName="ZipCode" VisibleIndex="5" Caption="Postnr">
                <EditFormSettings VisibleIndex="2" />
            </dxwgv:GridViewDataColumn>
            <dxwgv:GridViewDataColumn FieldName="City" VisibleIndex="6" Caption="By">
                <EditFormSettings VisibleIndex="3" />
            </dxwgv:GridViewDataColumn>
            <dxwgv:GridViewDataComboBoxColumn Name="CountryDropdown" FieldName="CountryId" Caption="Land" VisibleIndex="7">
                <EditFormSettings VisibleIndex="4" />
            </dxwgv:GridViewDataComboBoxColumn>
            <dxwgv:GridViewDataColumn FieldName="InActive" VisibleIndex="8" Caption="Deaktiveret">
                <EditFormSettings VisibleIndex="5" />
            </dxwgv:GridViewDataColumn>
        </Columns>
        <SettingsEditing PopupEditFormModal="false" PopupEditFormHorizontalAlign="Center" PopupEditFormAllowResize="false" Mode="PopupEditForm" PopupEditFormWidth="600px" />
        <Templates>
            <EditForm>
                <div style="text-align: left; padding: 2px">
                    <h4>Servicebil</h4>
                </div>
                <dxwgv:ASPxGridViewTemplateReplacement ID="Editors" ReplacementType="EditFormEditors" runat="server">
                </dxwgv:ASPxGridViewTemplateReplacement>
                <div style="text-align: right; padding: 2px">
                    <dxwgv:ASPxGridViewTemplateReplacement ID="UpdateButton" ReplacementType="EditFormUpdateButton" runat="server">
                    </dxwgv:ASPxGridViewTemplateReplacement>
                    <dxwgv:ASPxGridViewTemplateReplacement ID="CancelButton" ReplacementType="EditFormCancelButton" runat="server">
                    </dxwgv:ASPxGridViewTemplateReplacement>
                </div>
            </EditForm>
        </Templates>
    </dxwgv:ASPxGridView>
    <hr />
    
    <dxwgv:ASPxGridView ID="gvContainerServiceCarCoverage" runat="server" ClientInstanceName="gvContainerServiceCarCoverage" Width="250px" 
        KeyFieldName="ContainerId" AutoGenerateColumns="False" EnableCallBacks="True" 
        OnCustomCallback="gvContainerServiceCarCoverage_CustomCallback"
        OnRowInserting="gvContainerServiceCarCoverage_RowInserting"
        OnRowUpdating="gvContainerServiceCarCoverage_RowUpdating">
        <SettingsLoadingPanel Text="Henter&amp;hellip;" />
        <Settings ShowHeaderFilterButton="false" ShowGroupPanel="false" ShowFilterRow="false" />
        <SettingsPager AlwaysShowPager="True" PageSize="20" Position="TopAndBottom">
            <Summary 
                AllPagesText="Sider: {0} - {1} ({2} lagre)" 
                Text="Side {0} af {1} ({2} lagre)" />
        </SettingsPager>
        <SettingsText ConfirmDelete="Vil du slette tilknyttet lager for servicebil?" />
        <SettingsBehavior ConfirmDelete="True" AllowGroup="false" AllowFocusedRow="true" AllowDragDrop="true" AllowSelectByRowClick="true" />
        <ClientSideEvents Init="function(s, e) {
	        s.PerformCallback(gvServiceCar.GetFocusedRowIndex());
        }" />
        <Columns>
            <dxwgv:GridViewCommandColumn VisibleIndex="0">
                <EditButton Visible="True" Text="Rediger" />
                <NewButton Visible="True" Text="Opret" />
            </dxwgv:GridViewCommandColumn>
            <dxwgv:GridViewDataColumn FieldName="ServiceCarId" VisibleIndex="1" Caption="ServiceCarId" Visible="false">
            </dxwgv:GridViewDataColumn>
            <dxwgv:GridViewDataComboBoxColumn Name="ContainerDropdown" FieldName="ContainerId" Caption="Lager" VisibleIndex="2">
                <EditFormSettings VisibleIndex="1" />
            </dxwgv:GridViewDataComboBoxColumn>
        </Columns>
        <SettingsEditing PopupEditFormModal="false" PopupEditFormHorizontalAlign="Center" PopupEditFormAllowResize="false" Mode="PopupEditForm" PopupEditFormWidth="600px" />
        <Templates>
            <EditForm>
                <div style="text-align: left; padding: 2px">
                    <h4>Tilknyttet lagre</h4>
                </div>
                <dxwgv:ASPxGridViewTemplateReplacement ID="Editors" ReplacementType="EditFormEditors" runat="server">
                </dxwgv:ASPxGridViewTemplateReplacement>
                <div style="text-align: right; padding: 2px">
                    <dxwgv:ASPxGridViewTemplateReplacement ID="UpdateButton" ReplacementType="EditFormUpdateButton" runat="server">
                    </dxwgv:ASPxGridViewTemplateReplacement>
                    <dxwgv:ASPxGridViewTemplateReplacement ID="CancelButton" ReplacementType="EditFormCancelButton" runat="server">
                    </dxwgv:ASPxGridViewTemplateReplacement>
                </div>
            </EditForm>
        </Templates>                                            
    </dxwgv:ASPxGridView>
                  
    <dxwgv:ASPxGridViewExporter ID="gvExport" runat="server" GridViewID="gvServiceCar">
    </dxwgv:ASPxGridViewExporter>
                
</asp:Content>
